const Draw = (echarts, legendArr, dataArr) => {
  let option = {
    tooltip: {
      trigger: 'axis', axisPointer: { type: 'shadow' }
    },
    toolbox: {
      right: '4%',
      feature: {
        dataView: { show: true, readOnly: false },
        saveAsImage: { show: true }
      }
    },
    grid: { left: '4%', right: '4%', bottom: '4%', containLabel: true },
    xAxis: {
      type: 'category',
      data: legendArr,
      axisLabel: {
        interval: 0
      }
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        name: '心跳次数',
        type: 'bar',
        label: {
          normal: {
            show: true, position: 'top'
          }
        },
        data: dataArr
      }
    ]
  }
  let yHeartTotal = echarts.init(document.getElementById('yHeartTotal'))
  yHeartTotal.setOption(option)
  window.onresize = yHeartTotal.resize
}

export default Draw
